/* 资源文件引入(图片) */
export const importUrl = (url) => new URL(`/src/assets/${url}`, import.meta.url).href;

// 获取路由参数
export const getRouteParam = (name) => {
    var url = window.location.href;
    // 构建正则表达式模式，根据参数名进行匹配
    var pattern = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
    // 从URL中提取参数值
    var matches = pattern.exec(url);
    if (matches && matches[2]) {
      var paramValue = decodeURIComponent(matches[2].replace(/\+/g, " "));
      return paramValue;
    } else {
      return null;
    }
  };